<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>

<body>
  <div id="app">
    <input v-focus type="text">
    <div v-style="{fontSize:'30px',color:'red'}">太原2002</div>
  </div>
  <script>

    Vue.directive('focus', {
      inserted(el) {
        // debugger;
        el.focus();
      }
    })

    Vue.directive('style', {
      bind: function (el, arg) {
        console.log(arguments)
        for (key in arg.value) {
          el.style[key]=arg.value[key]
        }
        // el.style
      }
    })


    var vm = new Vue({
      el: "#app",
      data: {}
    })
  </script>
</body>

</html>